<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('修改福利地区配置')"/>
    <th:block th:include="include :: layout-latest-css"/>
    <th:block th:include="include :: ztree-css"/>
    <th:block th:include="include :: select2-css"/>

</head>
<body>
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" th:object="${welfareOpen}" id="form-welfareOpen-edit" AUTOCOMPLETE="OFF">
        <input id="id" name="id" type="hidden" th:field="*{id}"/>

        <div class="col-md-12">
            <div class="form-group">
                <label class="col-sm-3 control-label">工号：</label>
                <div class="col-sm-9">
                    <input type="text" name="badge" id="badge" th:field="*{badge}" class="form-control"
                           disabled="disabled">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">姓名：</label>
                <div class="col-sm-9">
                    <input type="text" name="name" class="form-control" th:field="*{name}" placeholder="请输入文本"
                           disabled="disabled">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">社保缴纳地区：</label>
                <div class="col-sm-9">
                    <select class="form-control" name="benefitCity" id="benefitCity">
                        <option value="0"></option>
                        <option th:each="welfareRegionConfigs:${welfareRegionConfigs}"
                                th:value="${welfareRegionConfigs.id }"
                                th:field="*{benefitCity}"   th:text="${welfareRegionConfigs.title }"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">社保账号：</label>
                <div class="col-sm-9">
                    <input type="text" name="beneAccount" id="beneAccount" th:field="*{beneAccount}"
                           class="form-control" placeholder="请输入社保账号">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">公积金缴纳地区：</label>
                <div class="col-sm-9">
                    <select class="form-control" name="accuCity" id="accuCity">
                        <option value="0"></option>
                        <option th:each="welfareRegionConfigs:${welfareRegionConfigs}"
                                th:value="${welfareRegionConfigs.id }"
                                th:field="*{accuCity}" th:text="${welfareRegionConfigs.title }"></option>

                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">公积金账号：</label>
                <div class="col-sm-9">
                    <input type="text" name="accuAccount" id="accuAccount" th:field="*{accuAccount}"
                           class="form-control" placeholder="请输入公积金账号">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">社保基数：</label>
                <div class="col-sm-9">
                    <input type="text" name="sbjs" id="sbjs" th:field="*{sbjs}" class="form-control"
                           placeholder="请输入社保基数">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">公积金基数：</label>
                <div class="col-sm-9">
                    <input type="text" name="gjjjs" id="gjjjs" th:field="*{gjjjs}" class="form-control"
                           placeholder="请输入公积金基数">
                </div>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: select2-js" />
<th:block th:include="include :: datetimepicker-js" />

<script type="text/javascript">
    var prefix = ctx + "welfare/welfareOpen";
    function submitHandler() {
        if ($.validate.form()) {
            edit();
        }
    }

    function edit() {
        if ($.validate.form()) {
            var data = $("#form-welfareOpen-edit").serializeArray();
            var badge = $("input[name='badge']").val();
            var name = $("input[name='name']").val();
            var beneAccount = $("input[name='beneAccount']").val();
            var accuCity = $("#accuCity").val();
            var accuAccount = $("input[name='accuAccount']").val();
            var sbjs = $("input[name='sbjs']").val();
            var gjjjs = $("input[name='gjjjs']").val();
            data.push({"id": "badge", "value": badge});
            data.push({"id": "name", "value": name});
            data.push({"id": "beneAccount", "value": beneAccount});
            data.push({"id": "accuCity", "value": accuCity});
            data.push({"id": "accuAccount", "value": accuAccount});
            data.push({"id": "sbjs", "value": sbjs});
            data.push({"id": "gjjjs", "value": gjjjs});
            $.operate.save(prefix + "/edit", data);
        }
    }


</script>
</body>
</html>